/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.classdiagram.tabbedproperties.filters;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.MultiplicityElement;
import org.eclipse.uml2.uml.util.UMLSwitch;

import com.cea.papyrus.core.tabbedproperties.UMLElementFilter;

/**
 * Filter for the multiplicity section
 */
public class MultiplicitySectionFilter extends UMLElementFilter {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean select(Object object) {
		if (!super.select(object)) {
			return false;
		}
		
		// switch on the element
		// if it is a Multiplicity Element => returns true
		// else return false
		return new UMLSwitch<Boolean>() {
			
			/**
			 * {@inheritDoc}
			 */
			@Override
			public Boolean caseMultiplicityElement(MultiplicityElement object) {
				return true;
			}
			
			/**
			 * {@inheritDoc}
			 */
			@Override
			public Boolean defaultCase(EObject object) {
				return false;
			}
			
		}.doSwitch(element).booleanValue();
	}
}